package cn.alpha.intell.rbtlib.view.widget.textview.view.base;

import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * @author white
 * @description：
 * @date 2016/12/13
 */

public abstract class BaseFontTextView extends TextView{

    public BaseFontTextView(Context context) {
        super(context);
        initTypeFace();
    }

    public BaseFontTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initTypeFace();
    }

    public BaseFontTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initTypeFace();
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public BaseFontTextView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
        initTypeFace();
    }

    private void initTypeFace(){
        setTypeface(getTypeFace());
    }

    /**
     * 获取自定义字体库路径
     * @return
     */
    abstract public Typeface getTypeFace();
}
